If p is the probability of an event happening (success) in a single trail, and $q = 1-p$ the probability of an event not happening (fail) in a single trail, then the probability that in $n$ trials that there are exactly $r$ successes, is the $\text{rth}$ term in the binomial expansion of $(p+q)^n$
$${n\choose r} p^r q ^{n-r}$$